<?php

  require_once 'JooS/Browser/Info.php';

  abstract class JooS_Browser_Abstract {
    private $_ua = null;
    
    abstract protected function getName();
    
    abstract protected function getVersion();

    final protected function getUA() {
      return $this->_ua;
    }
    
    final protected function throwException($ver) {
      require_once 'JooS/Browser/Exception.php';
      throw new JooS_Browser_Exception($ver);
    }
    
    final public function __construct($ua) {
      $this->_ua = $ua;
    }

    final public function getInfo() {
      $ret = null;
      try {
        if ($ver = $this->getVersion())
          $ret = new JooS_Browser_Info($this->getName(), $ver);
      }
      catch (JooS_Browser_Exception $e) {
        $ret = new JooS_Browser_Info();
      }
      return $ret;
    }
  }

?>